//首页
const express = require('express')
//引入连接池
const pool = require('../pool')
const router = express.Router()
router.get('/hot_city/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from hot_city', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
router.get('/topic/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from topic', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
router.get('/topic_detail/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from topic_detail limit ?,?', [(obj.pages-1)*7,7], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})

router.get('/mon_city', (req, res, next) => {
    var obj = req.query
    pool.query('select * from mon_city where mon = ?', [obj.month], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
router.get('/country_list/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from country_list where zhou = ?', [obj.zhou], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
module.exports = router